package com._54programer.sourcecode;

import com._54programer.sourcecode.initializer.SecondInitializer;
import org.springframework.boot.ResourceBanner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.util.StopWatch;

import java.util.Properties;

@SpringBootApplication
//属性设置方式2
//@PropertySource({"demo.properties"})
public class SourceCodeApplication {


    public static void main(String[] args) {
        //SpringApplication.run(SourceCodeApplication.class, args);





        //属性配置方式1
        SpringApplication springApplication = new SpringApplication(SourceCodeApplication.class);
        Properties properties = new Properties();
        properties.setProperty("name", "001");
        springApplication.setDefaultProperties(properties);
        springApplication.run(args);



    }


    /**
     * 添加自定义初始化器
     */
//    public static void main(String[] args) {
//        SpringApplication application = new SpringApplication(SourceCodeApplication.class);
//        application.addInitializers(new SecondInitializer());
//        application.run(args);
//    }



//    public static void main(String[] args) throws Exception {
//        //SpringApplication.run(SourceCodeApplication.class, args);
//
//        //banner
////        SpringApplication springApplication = new SpringApplication(SourceCodeApplication.class);
////        //springApplication.setBanner(new ResourceBanner(new ClassPathResource("banner_bak.txt")));
////        springApplication.addInitializers(new SecondInitializer());
////        springApplication.run(args);
//
//          //定时器
////        StopWatch myWatch = new StopWatch("myWatch");
////        myWatch.start("task1");
////        Thread.sleep(3000L);
////        myWatch.stop();
////        myWatch.start("task2");
////        Thread.sleep(5000L);
////        myWatch.stop();
////        myWatch.start("task3");
////        Thread.sleep(1000L);
////        myWatch.stop();
////        System.out.println(myWatch.prettyPrint());
//
//        //属性配置
//
//
//    }
}
